package cn.iocoder.yudao.module.design.dal.mysql.flowtaskaction;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.design.controller.admin.flowtaskaction.vo.FlowTaskActionExportReqVO;
import cn.iocoder.yudao.module.design.controller.admin.flowtaskaction.vo.FlowTaskActionPageReqVO;
import cn.iocoder.yudao.module.design.dal.dataobject.flowtaskaction.FlowTaskActionDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 任务处理模型 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface FlowTaskActionMapper extends BaseMapperX<FlowTaskActionDO> {

    default PageResult<FlowTaskActionDO> selectPage(FlowTaskActionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FlowTaskActionDO>()
                .eqIfPresent(FlowTaskActionDO::getTaskDesc, reqVO.getTaskDesc())
                .eqIfPresent(FlowTaskActionDO::getTaskType, reqVO.getTaskType())
                .eqIfPresent(FlowTaskActionDO::getTaskAction, reqVO.getTaskAction())
                .eqIfPresent(FlowTaskActionDO::getTaskMethod, reqVO.getTaskMethod())
                .eqIfPresent(FlowTaskActionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FlowTaskActionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FlowTaskActionDO::getId));
    }

    default List<FlowTaskActionDO> selectList(FlowTaskActionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FlowTaskActionDO>()
                .eqIfPresent(FlowTaskActionDO::getTaskDesc, reqVO.getTaskDesc())
                .eqIfPresent(FlowTaskActionDO::getTaskType, reqVO.getTaskType())
                .eqIfPresent(FlowTaskActionDO::getTaskAction, reqVO.getTaskAction())
                .eqIfPresent(FlowTaskActionDO::getTaskMethod, reqVO.getTaskMethod())
                .eqIfPresent(FlowTaskActionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FlowTaskActionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FlowTaskActionDO::getId));
    }

}
